<script type="text/javascript" src="<?=PATH_URL.'static/js/admin/jquery.slugit.js'?>"></script>
<script type="text/javascript">
$(document).ready( function() {
	$("#titleAdmincp").slugIt({
		events: 'keyup blur',
		output: '#slugAdmincp',
		space: '-'
	});
});

function save(){
	var options = {
		success:       showResponse  // post-submit callback 
    };
	$('#contentAdmincp').val(oEdit1.getHTMLBody());
	$('#frmManagement').ajaxSubmit(options);
	
}

function showRequest(formData, jqForm, options) {
	var form = jqForm[0];
	if(form.titleAdmincp.value == '' || form.descAdmincp.value == '' || $('#contentAdmincp').val() == '<br>' || $('#contentAdmincp').val() == ''){
		$('#txt_error').html('Please enter information!!!');
		$('#loader').fadeOut(300);
		show_perm_denied();
		return false;
	}
}

function showResponse(responseText) {
	if(responseText=='success'){
		location.href=root+"admincp/"+module+"/#/save";
	}
	
	if(responseText=='empty-title-exists'){
		$('#txt_error').html('Tiêu đề không được để trống!!!');
		$('#loader').fadeOut(300);
		$('#titleAdmincp').focus();
		show_perm_denied();
		return false;
	}
}
</script>
<div class="gr_perm_error" style="display:none;">
	<p><strong>FAILURE: </strong><span id="txt_error">Permission Denied.</span></p>
</div>
<div class="table">
	<div class="head_table"><div class="head_title_edit"><?=$this->session->userdata('Name_Module')?></div></div>
	<div class="clearAll"></div>

	<form id="frmManagement" action="<?=PATH_URL.'admincp/'.$module.'/save/'?>" method="post" enctype="multipart/form-data">
	<input type="hidden" value="<?=$id?>" name="hiddenIdAdmincp" />

	<div class="row_text_field_first">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Tiêu đề:</td>
				<td class="right_text_field"><input value="<?php if(isset($result->title)) { print $result->title; }else{ print '';} ?>" type="text" name="titleAdmincp" id="titleAdmincp" /></td>
			</tr>
		</table>
	</div>
    
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Slug:</td>
				<td class="right_text_field"><input value="<?php if(isset($result->slug)) { print $result->slug; }else{ print '';} ?>" type="text" name="slugAdmincp" id="slugAdmincp" /></td>
			</tr>
		</table>
	</div>
    
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Logo:</td>
				<td class="right_text_field"><input type="file" name="fileAdmincp[image]" /><?php if(isset($result->logo)){ if($result->logo!=''){ ?> <a style="margin-left: 20px;color: #3c4049;font-weight: bold" class="fancyboxClick" href="<?=PATH_URL.'static/images/'.$result->logo?>">Xem logo cũ</a><?php }} ?></td>
			</tr>
		</table>
	</div>
    
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Địa chỉ:</td>
				<td class="right_text_field"><input value="<?=$result->addres?>" type="text" name="addres" id="addres" /></td>
			</tr>
		</table>
	</div>
    
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Hotline:</td>
				<td class="right_text_field"><input value="<?=$result->hotline?>" type="text" name="hotline" id="hotline" /></td>
			</tr>
		</table>
	</div>
    
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Điện thoại:</td>
				<td class="right_text_field"><input value="<?=$result->phone?>" type="text" name="phone" id="phone" /></td>
			</tr>
		</table>
	</div>
    
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Email:</td>
				<td class="right_text_field"><input value="<?=$result->email?>" type="text" name="email" id="email" /></td>
			</tr>
		</table>
	</div>
    
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Bản đồ:</td>
				<td class="right_text_field"><textarea name="map" id="map" cols="" rows="5"><?=$result->map?></textarea></td>
			</tr>
		</table>
	</div>
    
    <div class="row_text_field">
		<table cellspacing="0" cellpadding="0" border="0" width="100%">
			<tr>
				<td class="left_text_field">Thông tin:</td>
				<td class="right_text_field" style="padding-right: 0px;">
                                    <textarea name="contentAdmincp" id="contentAdmincp" cols="" rows="8"><?=$result->info;?></textarea>
                                    <script type="text/javascript">
                                        var oEdit1 = new InnovaEditor("oEdit1");
                                        oEdit1.width = "100%";
                                        oEdit1.cmdAssetManager="modalDialogShow('"+root+"static/editor/assetmanager/assetmanager.php',640,445);";
                                        oEdit1.REPLACE("contentAdmincp");
                                    </script>
                                </td>
			</tr>
		</table>
	</div>

	</form>
</div>